<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="../../../static/layui/css/layui.css"
          th:href="@{/layui/css/layui.css}"/>
    <link rel="stylesheet" type="text/css" href="../../../static/layui/css/login.css"
          th:href="@{/layui/css/login.css}"/>
    <!-- <script type="text/jscript" src="../../../static/lay/modules/jquery.js"></script> -->
    <script type="text/jscript" src="../../../static/layui/layui.js" th:src="@{/layui/layui.js}"></script>
</head>
<body th:fragment="login">
<div id="log-btn" class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title">
        <li th:classappend="${em}==1 ?'layui-this':''">用户登录</li>
        <li th:classappend="${em}==2 ?'layui-this':''">邮箱登录</li>
        <input id="msg" type="hidden" th:value="${session.msg}">
    </ul>
    <div class="layui-tab-content">
        <!-- 账号登录 -->
        <div class="layui-tab-item" th:classappend="${em}==1 ?'layui-show':''">
            <form class="layui-form" action="" th:action="@{/User/loginbyuid}" method="post">
                <div class="layui-form-item">
                    <div class="input-style">
                        <i class="layui-icon">&#xe66f;</i>
                        <input type="text" name="uid" required lay-verify="required" placeholder="请输入账号"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="input-style">
                        <i class="layui-icon">&#xe673;</i>
                        <input type="password" name="password" required lay-verify="required" placeholder="请输入密码"
                               autocomplete="off"
                               class="layui-input">
                    </div>
                    <!-- <div class="layui-form-mid layui-word-aux">辅助文字</div> -->
                </div>
                <button type="submit" class="layui-btn custom-btn">登录</button>
            </form>
            <div class="unlogin">
                <a href="register.html" th:href="@{/User/register}">去注册</a>
            </div>
            <div class="unregister">
                <a href="retrieve.html" th:href="@{/User/retrieve}">找回密码</a>
            </div>
        </div>
        <!-- 邮箱登录 -->
        <div class="layui-tab-item" th:classappend="${em}==2 ?'layui-show':''">
            <form class="layui-form" action="" th:action="@{/User/loginbyemail}" method="post">
                <div class="layui-form-item">
                    <div class="input-style">
                        <i class="layui-icon">&#xe618;</i>
                        <input type="text" name="email" required lay-verify="required" placeholder="请输入邮箱"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="input-style2">
                        <i class="layui-icon">&#xe609;</i>
                        <input type="text" name="verification" required lay-verify="required" placeholder="请输入验证码"
                               autocomplete="off"
                               class="layui-input">
                    </div>
                    <button id="getcode" type="button" class="layui-btn layui-btn-primary custom-btn2" >获取验证码</button>
                    <input id="ver" type="hidden" th:value="${session.verfication}">

                    <!-- <div class="layui-form-mid layui-word-aux">辅助文字</div> -->
                </div>
                <button type="submit" class="layui-btn custom-btn">登录</button>
            </form>
            <div class="unlogin">
                <a href="register.html" th:href="@{/User/register}">去注册</a>
            </div>
            <div class="unregister">
                <a href="retrieve.html" th:href="@{/User/retrieve}">找回密码</a>
            </div>
        </div>

    </div>
</div>

<script>
    layui.use(['element', 'layer'], function () {
        var element = layui.element;
        var $ = layui.$,
            layer = layui.layer;
        if ($("#msg").val() != "") {
            if ($("#msg").val() == "登录成功!") {
                var index = parent.layer.getFrameIndex(window.name);
                //再执行关闭
                parent.layer.close(index);
                //刷新页面
                parent.location.reload();
            } else {
                layer.msg($("#msg").val());
            }
        }
    });
</script>
<script src="../../../static/layui/lineEffects.js" th:src="@{/layui/lineEffects.js}"></script>
</body>
</html>
